<?php


/*
 * Created on 2012-11-28
 * 公用命令 不管是群还是私聊或者讨论组
 */

/**
* A站新番推荐 @acfun
*/
function getAcfun() {
	$url = "http://www.acfun.tv/v/list67/index.htm";
	$do = new CurlUtil($url);
	$do->init();
	$body = $do->getBody();
	//echo $body;
	$match_name = '/(<div[^>]*class=\"item unit\"[^>]*>)(([^<]+|<(?!\/?div[^>]*>)|<div[^>]*>(?>(?3))*<\/div>)*)(<\/div>)/si';
	preg_match_all($match_name, $body, $m);
	$p = '/<img[^>]*src=\"(.*?)\"[^>]*>.*?<a[^>]*class=\"title\"[^>]*href=\"\/v\/(ac[^>]*)\"[^>]target=[^>]*title=\".*?标题:(.*?)UP主:(.*?)发布于(.*?)\/(.*?)\/(.*?)\">/si';
	preg_match($p, $m[0][0], $d);
	//print_r($m[0]);
	if (!$d) {
		return "目测遇到什么问题了。联系主人26158**89";
	}
	$l = "acfun 新番推荐：\n";
	$i = 5;
	$j = 10;
	foreach ($m[0] as $v) {
		if($j-->=0) {
			continue;
		}
		
		$d = null;
		preg_match($p, $v, $d);
		
		if (!$d || (!strpos($d[3], "新番") && !strpos($d[3], "月")))
			continue;
			//print_r($d);
		if ($i-- == 0)
			break;
		$l = $l . $d[3] . "\n";
		//		$l = $l ."[img]".$d[1]."[/img]";
		$l = $l . "\t投稿时间：" . $d[5] . "\tUp主：" . $d[4] . "\n";
		$l = $l . "\t" . $d[6] . "\t：" . $d[7] . "\n";
		$l = $l . "\t传送门-> http://www.acfun.tv/v/" . $d[2] . "\n";
		$l = $l . "\t吐槽\t@回复  {$d[2]}  (内容)\n";
	}
	return $l;
}

function deleteStudy() {
	$p = '/@(\S+)[\s]+(-p)*(\s)*([0-9]+)/';
	preg_match($p, $_POST[Message], $m);
	if (!$m && !$m[4]) {
		return "参数错误~{ac}";

	}
	//return ;
	$tableName = "td_study";
	if ($m[2]) {
		$tableName = "td_p_study";
	}
	$id = $m[4];
	$sql = "update {$tableName} set flag = 0 where id={$id} " ;
	$ret = DB :: GetTableRow($tableName, array (
				"id" => $id
			));
	DB :: Query($sql);
	$mess = "系统信息：在本群由【{$ret[nick]}({$ret[qq]})】学习的->( {$ret[question]} )词条已经被管理员删除,调教请自重,谢谢~";
	$api = new Api("SendClusterMessage");
	$api->doApi($ret[clusternum],$mess);
	return "删除成功~";
}

function getYouKu() {
  $url = "http://comic.youku.com/";
  $do = new CurlUtil($url);
  $do->userAgent ="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.29 Safari/537.22";
  $do->referer="http://www.youku.com/";
  $header=array("Content-Type: text/xml;charset=utf-8");
  $do->httpheader = $header ; 
  $do->header = 1;
  $do->init();
  $body = $do->getBody();
 
  
  
  echo $body;
  $match_name = '/(<div[^>]*class=\"showMixColl_W\"[^>]*>)(([^<]+|<(?!\/?div[^>]*>)|<div[^>]*>(?>(?3))*<\/div>)*)(<\/div>)/si';
  

//    $pul='/<li[^>]*class=\"p_link\">[^<]*<a[^>]*title=[^>]*href=\"([^>]*)\"[^>]*charset/';
//    preg_match_all($pul,$m[2][1],$v);
//    foreach($v[1] as $k) {
//      
// 
//    }

 
}
/**
 * B站新番推荐 @bl
 */
function getBilibili() {
	$url = "http://www.bilibili.tv/video/bangumi-two-1.html?t=" . time();
	$do = new CurlUtil($url);
	$do->binarytransfer = true;
	$do->encoding = 'gzip,deflate';
	$do->init();
	$body = $do->getBody();
	//echo $body;
	$match_name = '/(<li[^>]*class=\"l1\"[^>]*>)(([^<]+|<(?!\/?li[^>]*>)|<li[^>]*>(?>(?3))*<\/li>)*)(<\/li>)/si';
	preg_match_all($match_name, $body, $m);

	$pul = '/<a[^>]*href=\"([^>]*)\"[^>]*target=[^>]*class=\"title\"[^>]*>([^<]*)<\/a>/si';
	$l = "哔哩哔哩新番推荐：\n";
	$i = 7;
	foreach ($m[2] as $v) {
		$i--;
		if ($i == 0)
			break;
		$d = null;
		preg_match_all($pul, $v, $d);
		// print_r($d);
		$av = substr($d[1][0],7);
		$av = str_replace("/","",$av);
		$l = $l . $d[2][0] . "\n";
		$l = $l . "传送门-> http://www.bilibili.tv" . $d[1][0] . "\n";
		$l = $l . "吐槽\t@回复  {$av}  (内容)\n";

	}
	return $l;
}

/**
 * 天气预报 @w 地区
 */
function getWeather() {
	$p = '/@(\S+)\s+(.+)/';
	preg_match($p, $_POST[Message], $m);
	$city = $m[2];
	if (trim($city) == "丫丫") {
		return "主人心情今天不好-。-";

	}
	if (trim($city) == "兵库北") {
		return "[Image{96E94562-A02C-8227-4306-401E053EF364}.jpg]";

	}
	$city = str_replace(' ', '', $city);
	$url = "http://www.baidu.com/s?tn=baiduhome_pg&ie=utf-8&f=8&rsv_bp=1&rsv_spt=1&rsv_sug3=10&rsv_sug=0&rsv_sug4=564&rsv_sug1=5&inputT=2930&wd=" . rawurlencode($city . " 天气预报");
	$do = new CurlUtil($url);
	$do->init();
	$body = $do->getBody();// op_weather4_twoicon_container_div
	$match_name = '/(<div[^>]*class=\"op_weather4_twoicon\"[^>]*>)(([^<]+|<(?!\/?div[^>]*>)|<div[^>]*>(?>(?3))*<\/div>)*)(<\/div>)/si';
	preg_match($match_name, $body, $m);
//	print_r($m[2]);
//	preg_match($match_name, $m[2], $x);
//	print_r($x);
	$mess = strip_tags($m[2]);
	
	$mess = trim($mess);
	$mess = str_replace("         ","|",$mess);
	$msss = explode("|",$mess);
	
	$message = "";
	for($i=0;$i<count($msss);$i++) {
		if(strlen(trim($msss[$i]))<=1) {
			continue;
		}
		if(strpos($msss[$i],"op_weather4")) {
			continue;
		}
		if(strpos($msss[$i],"周")) {
			$message=$message."\n".trim($msss[$i])."\t";
		} else
			$message.=trim($msss[$i])."\t";
	}
	//echo $message;
	//return;
	//$p2 = '/<td[^>]*>.*?<\/td>/si';
	//preg_match_all($p2, $m[0], $n2);
	if ($message!="") {
		$message = str_replace("&nbsp;", "", $message);
		return $city . "的天气情况如下：\r\n".$message ;
	} else
		return "就不告诉你 乃自己问度娘去 ~~>_<~~ 。。。。。";

}

function searchMusicLrc() {
	$p = '/@(\S+)\s+(.+)/';
	preg_match($p, $_POST[Message], $m);
	$name = $m[2];
	$do = new CurlUtil("http://music.baidu.com/search/lrc?key=".rawurlencode($name));
	$do->init();
	$body = $do->getBody();
	//$match_name = '/<p[^>]id=\"lyricCont\-0\">([])/is';
	$match_name = '/(<p[^>]*id=\"lyricCont-0\"[^>]*>)(([^<]+|<(?!\/?p[^>]*>)|<p[^>]*>(?>(?3))*<\/p>)*)(<\/p>)/si';
	preg_match($match_name, $body, $n);
	$mess = strip_tags($n[2]);
	return $mess;
}
/**
 * 
 */
function sendAcfunMessage() {

	$auth = new Authority();
	$cp = new ClusterParam();
		if($_POST[Sender]!="261589289") {
			
			//return "暂时关闭该服务（坏笑~~";
		}
	$p = '/@回复[\s]*([aA][cvCV])([0-9]{2,8})[\s]*([0-9]+)*(.*)/si';
	preg_match($p, trim($_POST[Message]), $m);
	
	if (strtolower($m[1]) == "ac") {
		$username = $cp->getMyParamValue("acusername");
		$password = $cp->getMyParamValue("acpassword");
		if (!$username || !$password) {
			return "{myname}。。你还没绑定好acfun账号。请点击http://wpa.qq.com/msgrd?v=3&uin=1004634672 输入 /绑定   来完成操作= =。。";
		}
	} else if(strtolower($m[1]) == "av") {
		
		$username = $cp->getMyParamValue("avusername");
		$password = $cp->getMyParamValue("avpassword");
		if (!$username || !$password) {
			return "{myname}。。你还没绑定好bilibili账号。请点击http://wpa.qq.com/msgrd?v=3&uin=1004634672 输入 /绑定   来完成操作= =。。";
		}
		
		$cookes_file = ROOT_PATH . "/Temp/" .md5("bili".$username.$password) . ".dat";
		if(!file_exists($cookes_file)) {
			return "您还未登录哔哩哔哩，请执行 @lgbl 来登录哔哩哔哩";
		}
		
		$post_fields2 = "quoteID=" . URLEncode("") ."&msg=" . URLEncode($m[4]) .  "&action=send&aid=" . $m[2];
		//$tem = ROOT_PATH . "/Temp/"."tempfile.txt";
		//$fp = fopen($tem,'wb');
		$do = new CurlUtil("http://www.bilibili.tv/feedback/post");
		$do->cookie_file = $cookes_file;
		$do->post_fields = $post_fields2;
		//$do->fp = $fp;
		$do->init();
		$output = $do->getBody();
		//echo $output;
		//fclose($fp);
		 return "回复：http://www.bilibili.tv/video/av{$m[2]}/ 成功~";
		
		
		 //sendBiliMessage($m,$cp);
	} else {
		return "参数错误{ac}";
	}
	//if(!checkVedio($m[2]) && $_POST[ClusterNum]!='186821264') {
	//	return "该投稿还未审核通过";
	//}
	
		$arrmess = getAcfunCid($m[2], $m[3]);
	
	if (!$arrmess) {
		return "不存在的楼层或者超出范围";
	}
	$time = date("Y-m-d H:i:s", time() + 8 * 3600);
	if ($m[2] && $m[4]) {
		if (!($auth->adminLevel > 1) && $auth->clusterLevel < 5) {
			return "好感度5级以下的不开放此功能╮(╯▽╰)╭";
		}
		if (!$m[3])
			$m[3] = 0;
		$mess = $m[4];
		if ($auth->adminLevel > 1 || ($auth->clusterLevel >= 6 && $cp->getMyParamValue("ac_is_add_e") == "不添加"))
			$mess = $m[4];
		else {
			$mess = $m[4] . "\r\n[size=12px][color=#FF9900]【通过索妮娅发表】[/color][/size]";
		}
		$mess = getAcface($mess);
//		$mess = $mess." ——【来自QQ索妮娅酱客户端  by {$_POST[Nick]}】";
		$cookes_file = ROOT_PATH . "/Temp/" .md5($username.$password) . ".dat";
		if (!file_exists($cookes_file)) {
			$post_fields = "username=" . URLEncode($username) . "&password=" . URLEncode($password);
			$do = new CurlUtil("http://www.acfun.tv/login.aspx");
			$do->cookie_file = $cookes_file;
			$do->post_fields = $post_fields;
			$do->header = 1;
			$do->init();
			$out = $do->getBody();
		}
		$post_fields2 = "text=" . URLEncode($mess) . "&quoteId=" . URLEncode($arrmess[0]) . "&contentId=" . $m[2];
		$do = new CurlUtil("http://www.acfun.tv/comment.aspx");
		$do->cookie_file = $cookes_file;
		$do->post_fields = $post_fields2;
		$do->init();
		$output = $do->getBody();
		$a = @ json_decode("[" . $output . "]");
		//echo $output ;
		if (!$a[0]->success) {
			unlink($cookes_file) ;
			return "回复失败：" . "用户名或密码配置有误 或者 acid有误";
		} else {
			
				return "回复 http://www.acfun.tv/v/ac" . $m[2] . " 成功! 所在楼层为" . ($arrmess[1] + 1) . "楼";
			
		}
	} else {
		return "参数错误！\n(好感度5级以下的群不开放此功能，6级以下的群不可以去掉后缀,以防猴子查水表~！)";
	}

}

function checkVedio($acid) {
	$do = new CurlUtil("http://api.acfun.tv/videos/".$acid);
	$do->init();
	$output = $do->getBody();
	if($do->state=="404")
	  return false;
	else
	  return true;
}

function sendBiliMessage($m,$cp) {}
/**
 * 获取福利图片
 */
function getFuli() {
	$dir = ROOT_PATH . "include/image/";
	$dh = opendir($dir);
	//echo $dir."/"."1.bmp --->".filesize($dir."/"."1.bmp");
	$arr = array ();
	$i = 0;
	while (($file = readdir($dh)) != false) {
		if ($file != "." && $file != "..") {
			//$extend =explode("." , $file);
			//	print_r($extend);
			 //rename($dir."/".$file,$dir."/".md5($extend[0]).".".$extend[1]);
			//echo $dir."/".$file."--->".$dir."/".md5($extend[0]).".".$extend[1]."<br />";
			if (filesize($dir . "/" . $file) <= 800 * 600)
				$arr[$i++] = $file;

		}

	}
	closedir($dh);
	$index = rand(0, count($arr) - 1);
	return "[img]http://localhost/SoniaRobot/include/image/" . $arr[$index] . "[/img]";

}

function getAcfunTrend() {
	$p = '/@趋势[\s]*(-([dwmy]*)([1234567]*)([ptc]*))*/si';
	preg_match($p, trim($_POST[Message]), $m);
	if ($m[2]) {
		if ($m[2] == "d") {

		}
	}

}



function getTS() {
	$p = '/@[\S]+[\s]+(.*)/si';
	preg_match($p, trim($_POST[Message]), $m);
	$do = new CurlUtil("http://www16.zzu.edu.cn/qtss/zzjpoem1.dll/query");
	$post_fields = "B3=" . URLEncode("题目检索") . "&T1=" . URLEncode(mb_convert_encoding(trim($m[1]), 'GB2312', 'UTF-8'));
	$do->post_fields = $post_fields;
	$do->init();
	$out = $do->getBody();
	$out = mb_convert_encoding($out, 'UTF-8', 'GB2312');
	$p = '/(http:\/\/www16.zzu.edu.cn\/qtss\/zzjpoem1.dll\/viewoneshi[^>]*)\">/is';
	preg_match_all($p, $out, $n);

	if ($n[1]) {
		$rand = rand(0, count($n[1]) - 1);
		$do = new CurlUtil($n[1][$rand]);
		$do->init();
		$out = $do->getBody();
		$out = mb_convert_encoding($out, 'UTF-8', 'GB2312');
		$p = '/http:\/\/www16.zzu.edu.cn\/qtss\/zzjpoem1.dll[^>]*>(.*?)<\/table>/is';
		preg_match($p, $out, $i);
		$out = strip_tags($i[1]);
		$out = preg_replace('/($\s*$)|(^\s*^)/m', '', $out);
		$out = preg_replace('/^(\s*)/m', '', $out);
		$out = str_replace('&nbsp;', '', $out);
		$out = str_replace("。", "。\n", $out);
		return $out;

	} else {
		return "木有找到与【{$m[1]}】相关的诗词= =";
	}
}

function help() {
	return " 您可以使用以下命令：
1.  @help\t\t--打开帮助
2.  @report\t\t--查看当天聊天记录信息
3.  @weather 城市\t--查询天气 
4.  @群管理\t\t-进入群管理中心
     @bl\t\t--哔哩哔哩新番推荐
     @acfun\t\t--acfun新番推荐
5.  @学习\t\t--例子：@学习 你是谁？ 回答 我是小丫！
    @忘记 XX\t\t--例子：@忘记 你是谁？
     更多命令、、索妮娅酱才不告诉你们呢。\n" .
	"或者去索妮娅的新浪微博  @傲娇索妮娅酱  
		";

}

function getQRCode() {
	require (ROOT_PATH . 'include/phpqrcode/phpqrcode.php');
	$p = '/@二维码\s+(.*)/';
	preg_match($p, trim($_POST[Message]), $m);

	$data = trim($m[1]);

	// 纠错级别：L、M、Q、H
	$errorCorrectionLevel = 'L';
	$filename = "Temp/{$_POST[Sender]}" . time() . ".png";
	// 点的大小：1到10
	$matrixPointSize = 4;
	QRcode :: png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
	return "[img]http://127.0.0.1/SoniaRobot/" . $filename . "[/img]";
}

function getRP() {
	$p = '/@rp\s*(.*)/';
	preg_match($p, trim($_POST[Message]), $m);
	if ($m[1] && trim($m[1]) != "") {
		$name = trim($m[1]);
	} else {
		$name = $_POST[Nick];
	}
	if (trim($name) == "") {
		$name = "Baka";
	}
	$nn = $name;
	$name = URLEncode(mb_convert_encoding($name, 'GB2312', 'UTF-8').date('Y-m-d H', time()));//
	$url = "http://xingming.net/renpin.asp?youname1=&youname2={$name}&sex=1&ok=cidu";
	$do = new CurlUtil($url);
	$do->init();
	$out = $do->getBody();
	$out = mb_convert_encoding($out, 'UTF-8', 'GB2312');
	$p = '/(您的姓名.*?)<div/is';
	preg_match($p, $out, $n);
	$out = strip_tags($n[1]);
	$out = str_replace('　', '', $out);
	$out = preg_replace('/您的姓名.*?\r/is','您的姓名:'.$nn,trim($out));
	return $out;
}

function getQS() {
	$p = '/@qs\s*(.*)/';
	preg_match($p, trim($_POST[Message]), $m);
	if ($m[1] && trim($m[1]) != "") {
		$name = trim($m[1]);
	} else {
		$name = $_POST[Nick];
	}
	if (trim($name) == "") {
		$name = "Baka";
	}
	$name =URLEncode($name);
	$url = "http://cn.prelife.org/{$name}/";
	$do = new CurlUtil($url);
	$do->binarytransfer = true;
	$do->encoding = 'gzip,deflate';
	$do->init();
	$out = $do->getBody();
	//echo $out;
	//$p = '/<div id=\"showimg_r\"><img src=\"(.*?)\"/is';
	$p = '/\[img\](http[^\[]*)/is' ;
	preg_match($p, $out, $n);
	//print_r($n);
	//return ;
	list ($src_w, $src_h) = getimagesize($n[1]);
	$dst_h = 176;
	$dst_w = 240;
	$dst_scale = $dst_h / $dst_w; //目标图像长宽比
	$src_scale = $src_h / $src_w; // 原图长宽比

	if ($src_scale >= $dst_scale) {
		// 过高
		$w = intval($src_w);
		$h = intval($dst_scale * $w);
		$x = 0;
		$y = ($src_h - $h) / 3;
	} else {
		// 过宽
		$h = intval($src_h);
		$w = intval($h / $dst_scale);
		$x = ($src_w - $w) / 2;
		$y = 0;
	}
	// 剪裁
	$source = imagecreatefromjpeg($n[1]);
	$croped = imagecreatetruecolor($w, $h);
	imagecopy($croped, $source, 0, 0, $x, $y -10, $src_w, $src_h);
	// 缩放
	$scale = $dst_w / $w;
	$target = imagecreatetruecolor($dst_w, $dst_h);
	$final_w = intval($w * $scale);
	$final_h = intval($h * $scale);
	imagecopyresized($target, $croped, 0, 0, 0, 0, $final_w, $final_h, $w, $h);
	// 保存
	$timestamp = "Temp/".$_POST[Sender].time().".jpg";
	imagejpeg($target, "{$timestamp}");
	imagedestroy($target);
	return "[img]http://127.0.0.1/SoniaRobot/{$timestamp}[/img]";
}

function addFace() {
	$p = '/@acFace[\s]+(.*)->(.*)/is';
	preg_match($p, trim($_POST[Message]), $m);
	@ DB :: SaveTableRow('td_acface', array (
		'key' => trim($m[1]),
		'acface' => trim($m[2])
	));
	return "添加成功";
	// print_r($m);
}
function roll() {
	$p = '/@roll\s*([\d]+)/';
	preg_match($p, trim($_POST[Message]), $m);
	$n = 100;
	if($m[1]) {
		$n = $m[1];
	}
	$ran = rand(0,$n);
	return "本次掷出：{$ran},上限为：{$n}";
}
function setCheckCode() {
	$code = createCheckCode();
	$_SESSION['CHECK_CODE'] = $code ;
	return "加群验证码：".$code ;
}

function checkin() {
	$cp = new ClusterParam();
	$p = '/@([\S]+)(.*)/si';
	preg_match($p, trim($_POST[Message]), $m);
	if($m[2] && trim($m[2])!="") {
		
		return signBaidu($p,$m[2]);
	}
	$username = $cp->getMyParamValue("acusername");
	$password = $cp->getMyParamValue("acpassword");
	if(!$username || !$password ) {
		return "{myname}。。你还没绑定好账号。请点击http://wpa.qq.com/msgrd?v=3&uin=1004634672 输入 /绑定   来完成操作= =。。";
	}
	$cookes_file = ROOT_PATH . "/Temp/" .md5($username.$password) . ".dat";
	if (!file_exists($cookes_file)) {
		$post_fields = "username=" . URLEncode($username) . "&password=" . URLEncode($password);
		$do = new CurlUtil("http://www.acfun.tv/login.aspx");
		$do->cookie_file = $cookes_file;
		$do->post_fields = $post_fields;
		$do->header = 1;
		$do->init();
	    $do->getBody();
	}
	$do = new CurlUtil("http://www.acfun.tv/member/checkin.aspx?t=".time());
	$do->cookie_file = $cookes_file;
	$do->init();
	$out = $do->getBody();
	$a = @ json_decode("[" . $out . "]");
	if(!$a) {
		@unlink($cookes_file) ;
		return "操作超时~~!";
	}
	//print_r($a);
			$do = new CurlUtil("http://www.acfun.tv/member/splash.aspx");
			$do->cookie_file = $cookes_file;
			$p = '/<span.*?>Uid:([0-9]+).*?<p[^>]*.*?title=\"当前总经验值：(.*?)\/.*?下一级所需总经验值：(.*?)\"[^>]*?class=\"level\"[^>]*>.*?Level.([0-9]+).*?今日在线时长.*?>([0-9]+).*?</is';
				
	if($a[0]->success) {
		$do->init();
		$out = $do->getBody();
		preg_match($p, $out, $m);
		$do = new CurlUtil("http://www.acfun.tv/online.aspx?uid={$m[1]}");
			$do->cookie_file = $cookes_file;
			$do->init();
			$out = $do->getBody();
			$n = @ json_decode("[" . $out . "]");
			$duration = $n[0]->duration;
			$m[5] = floor($duration/60);
			
			$do = new CurlUtil("http://www.acfun.tv/member/#area=splash");
			$do->cookie_file = $cookes_file;
			$do->init();
			$out = $do->getBody();
			$p = '/href=\"#area=banana\"><span class=\"pts\">([^<]+)<.*?href=\"#area=golden-banana\"><span class=\"pts\">([^<]+)</is';
			preg_match($p, $out, $n);
		//print_r($m);
		return "今日在线时长：{$m[5]}分钟\n当前等级:Level.{$m[4]}\n当前总经验值:{$m[2]}\n下一级所需总经验值：{$m[3]}\n香蕉数量：{$n[1]}\n金香蕉量：{$n[2]}\n{alt}在Acfun签到成功~经验值+3，香蕉+3,{ac}" ;
	} else {
		if($a[0]->result == "用户未登录") {
			@unlink($cookes_file) ;
			return "{ac}你所绑定的账号或者密码有问题-.-" ;
		} else if($a[0]->result == "您今天已签到过") {
			$do->init();
			$out = $do->getBody();
			preg_match($p, $out, $m);
			$do = new CurlUtil("http://www.acfun.tv/online.aspx?uid={$m[1]}");
			$do->cookie_file = $cookes_file;
			$do->init();
			$out = $do->getBody();
			$n = @ json_decode("[" . $out . "]");
			$duration = $n[0]->duration;
			$m[5] = floor($duration/60);
			
			$do = new CurlUtil("http://www.acfun.tv/member/");
			$do->cookie_file = $cookes_file;
			$do->init();
			$out = $do->getBody();
			//echo $out;
			$p = '/href=\"#area=banana\"><span class=\"pts\">([^<]+)<.*?href=\"#area=golden-banana\"><span class=\"pts\">([^<]+)</is';
			preg_match($p, $out, $n);
			//print_r($n);
			//@unlink($cookes_file) ;
			return "今日在线时长：{$m[5]}分钟\n当前等级:Level.{$m[4]}\n当前总经验值:{$m[2]}\n下一级所需总经验值：{$m[3]}\n香蕉数量：{$n[1]}\n金香蕉量：{$n[2]}\n{alt}你今天在Acfun不是签过到了吗~~{ac}";
		} else {
			@unlink($cookes_file) ;
			return $a[0]->result ;
		}
	}
}

function getAcCard() {
	$cp = new ClusterParam();
	$username = $cp->getMyParamValue("acusername");
	$password = $cp->getMyParamValue("acpassword");
	$p = '/@[\S]+[\s]*(.*)/si';
	preg_match($p, trim($_POST[Message]), $m);	
	if($m[1] && trim($m[1])!="") {
		$username = trim($m[1]);
	}else if(!$username) {
		return "参数错误~{a}";
	}
	$cookes_file = ROOT_PATH . "/Temp/" .md5("罗丫丫"."3088100") . ".dat";
	if (!file_exists($cookes_file)) {
		$post_fields = "username=" . URLEncode("罗丫丫") . "&password=" . URLEncode("3088100");
		$do = new CurlUtil("http://www.acfun.tv/login.aspx");
		$do->cookie_file = $cookes_file;
		$do->post_fields = $post_fields;
		$do->header = 1;
		$do->init();
	    $do->getBody();
	}
	$url =  "http://www.acfun.tv/usercard.aspx?username=".URLEncode($username);
	//echo $url;
	$do = new CurlUtil($url);
	$do->cookie_file = $cookes_file;
	$do->init();
	$out = $do->getBody();
	$a = @ json_decode("[" . $out . "]");
	//print_r($a);
	if(!$a) {
		return "网络异常~{ac}";
	}
	if(!$a[0]->success) {
		return $a[0]->result;
	}
	$obj = $a[0]->userjson;
	//if( $obj->lastLoginDate)
	$area = getAreaByIp($obj->lastLoginIp);
	$mess =  "[img]".$obj->avatar."[/img]\n".
			"用户名\t".$obj->name."\n".
			"UID\t\t".$obj->uid."\n".
			"注册时间\t".$obj->regTime."\n".
			"最后登录时间\t".$obj->lastLoginDate."\n".
			"最后登录地点\t".$area."\n".
			"投稿总数\t".$obj->posts."\n".
			"总点击数\t".$obj->views."\n".
			"总收藏数\t".$obj->stows."\n".
			"总评论数\t".$obj->comments."\n".
			"粉丝数\t".$obj->fans."\n".
			"收听\t\t".$obj->follows."\n";
			return $mess;
}

function getAreaByIp($ip) {
	$p = '/<p[^>]*class=\"op_ip_detail\">[^><]*来.*?<strong>([^<]+)</';
	$url = "http://www.baidu.com/s?tn=monline_5_dg&bs=1%2B1%2B2%3D%3F&f=8&rsv_bp=1&rsv_spt=1&wd=" . rawurlencode($ip);
	$do = new CurlUtil($url);
	$do->init();
	$output =$do->getBody() ;  
	preg_match($p, $output, $n);
	$number = preg_split("/\s/", $n[1]);
	return $number[0];
	
}

function test() {
	$p = '/@[\S]+[\s]+([0-9]+)(.*)/si';
	preg_match($p, trim($_POST[Message]), $m);
	//print_r($m);	
	$i = 10;
	$c = "a";
	if($m && $m[1]) {
		$i = (int)$m[1];
		if($m[2]) {
			$c = trim($m[2]) ;
		}
	} else {
		return " 参数错误~";
	}
	$mess = "";
	for($x = 0 ;$x<$i ;$x++) {
		$mess = $mess.$c;
	}
	
	return $mess;
}

function getMyInfo() {
	  
}

function getAcDown() {
	$p = '/@[\S]+[\s]+(ac[0-9]+)(.*)/si';
	preg_match($p, trim($_POST[Message]), $m);
	print_r($m);
	$url = "http://www.acfun.tv/v/".$m[1];
	$do = new CurlUtil($url);
	$do->init();
	$output =$do->getBody() ;  
	echo $output;
	$p = '/<div class=\"hidden\">\[video\]([0-9]+)\[\/video\]<\/div>/is' ;
	preg_match($p, $output, $m);
	print_r($m);
	$url = "http://www.acfun.tv/api/player/vids/{$m[1]}.aspx";
	$do = new CurlUtil($url);
	$do->init();
	$out = $do->getBody();
	$a = @ json_decode("[" . $out . "]");
	print_r($a);
	$type = $a[0]->vtype;
	$cid = $a[0]->cid;
	$url = "http://2dland.sinaapp.com/video.php?action=xml&type=acfun_{$type}&vid={$cid}";
	echo $url;
	$do = new CurlUtil($url);
	$do->init();
	$out = $do->getBody();
	echo $out;
	$p = '/<!\[CDATA\[(.*)?\]\]>/is';
	preg_match($p, $out, $m);
	print_r($m);
	
}

function getFyCode() {
  $p = '/@([\S]+)[\s]+(.*)/si';
	preg_match($p, trim($_POST[Message]), $m);
  if($m[1]=="佛曰") {
    $action = "Encode";
  } else {
    $action = "Decode";
  }
  $post_fields = "orignalMsg=" . URLEncode($m[2]) . "&action=" .$action;
  $do = new CurlUtil("http://keyfc.net/bbs/tools/tudou.aspx");
  $do->post_fields = $post_fields;
  $do->header = 1;
  $do->init();
  $body  = $do->getBody();
  $p = '/<!\[CDATA\[(.*)?\]\]>/is';
	preg_match($p, $body, $n);
  if($n)
     return $n[1];
}

function getMyAcfunMess() {
	$p = '/@([\S]+)[\s]+(.*)/si';
	
	$cp = new ClusterParam();
	$username = $cp->getMyParamValue("acusername");
	$password = $cp->getMyParamValue("acpassword");
	if(!$username || !$password ) {
		return "{myname}。。你还没绑定好账号。请到私聊窗口 输入 /绑定   来完成操作= =。。";
	}
	$cookes_file = ROOT_PATH . "/Temp/" .md5($username.$password) . ".dat";
	if (!file_exists($cookes_file)) {
		$post_fields = "username=" . URLEncode($username) . "&password=" . URLEncode($password);
		$do = new CurlUtil("http://www.acfun.tv/login.aspx");
		$do->cookie_file = $cookes_file;
		$do->post_fields = $post_fields;
		$do->header = 1;
		$do->init();
	    $do->getBody();
	}
	$do = new CurlUtil("http://www.acfun.tv/member/unRead.aspx");
	$do->cookie_file = $cookes_file;
	$do->init();
	$out = $do->getBody();
	$a = @ json_decode("[" . $out . "]");
	if(!$a) {
		@unlink($cookes_file) ;
		return "操作超时~~!";
	}
	if($a[0]->success) {
		$m = "";
		$m.="最新推送：\t".$a[0]->newPush."条\n";
		$m.=" @到我的：\t".$a[0]->mention."条\n";
		
		if($a[0]->mention>0) {
			$do = new CurlUtil("http://www.acfun.tv/api/member.aspx?name=mentions&pageNo=1&pageSize=10");
		 	$do->cookie_file = $cookes_file;
		 	$do->init();
		 	$out = $do->getBody();
		 	$res = @ json_decode($out);
		 	$men = $a[0]->mention;
		 	for($i=0;$i<$men;$i++) {
		 		$qi = "c".$res->commentList[$i];
		 		$url = $res->contentList[$i]->url;
		 		$tem = $res->commentContentArr->$qi->content;
		 		$layer = $res->commentContentArr->$qi->count;
		 		$tem = preg_replace('/\[[^\]]*\]/m', '', $tem);
		 		$tem = preg_replace('/<br[^>]*>/m', '', $tem);
		 		$tem = preg_replace('/\n|\r/m', '', $tem);
		 		$m.="\t查看->http://www.acfun.tv".$url."#layer=".$layer."\n\t".$tem."\n";
		 	}
		}
		$m.="未读私信：\t".$a[0]->unReadMail."条\n";
		$m.="新增粉丝：\t".$a[0]->newFollowed."个\n";
		return $m;
		
	} else {
		return "操作异常";
		@unlink($cookes_file) ;
	}
	
}

function loginBili() {
	$p = '/@([\S]+)[\s]+-c(.*)/si';
	$cp = new ClusterParam();
	preg_match($p, trim($_POST[Message]), $m);
	$username = $cp->getMyParamValue("avusername");
	$password = $cp->getMyParamValue("avpassword");
	if (!$username || !$password) {
		return "{myname}。。你还没绑定好bilibili账号。请到私聊窗口 输入 /绑定   来完成操作= =。。";
	}
		$cookes_file = ROOT_PATH . "/Temp/" .md5("bili".$username.$password) . ".dat";
	if(!$m[2]) { 
		
		$fp = fopen(ROOT_PATH . "/Temp/".$_POST['Sender'].'code.png','wb');
		$do = new CurlUtil("https://secure.bilibili.tv/captcha?r=".time());
		 $do->cookie_file = $cookes_file;
		 $do->fp = $fp;
		 $do->https = true;
		 $do->init();
		 $do->getBody();
		 fclose($fp);
		 //echo "需要输入验证码：并执行命令：@lgbl -c 验证码 来登录";
		 return "执行命令：@lgbl -c 验证码  \n[img]http://127.0.0.1/SoniaRobot/Temp/".$_POST['Sender'].'code.png[/img]';
	} else {
 			$post_fields = "keeptime=2592000&vdcode=".trim($m[2])."&act=login&gourl=".URLEncode("")."&userid=" . URLEncode($username) . "&pwd=" . URLEncode($password);
			$tem = ROOT_PATH . "/Temp/"."tempfile.txt";
			$fp = fopen($tem,'wb');
			$do = new CurlUtil("https://secure.bilibili.tv/login");
			$do->cookie_file = $cookes_file;
			$do->https = true;
			$do->post_fields = $post_fields;
			$do->fp=$fp;
			$do->header = 1;
			$do->init();
			$out = $do->getBody();
 			fclose($fp);
 			$p = '/document\.write\(\"([^)]*)\"\)/si';
			$a = file_get_contents($tem);
			preg_match($p, $a, $n);
			@unlink($tem) ;
			if(strpos("yaya".$n[1], "成功登录")) {
				return "成功登录，可以做其他操作了~";
			} else {
				@unlink($cookes_file) ;
				return $n[1];
			}
 }
}

function loginBaidu() {
	$p = '/@([\S]+)[\s]+-c(.*)/si';
	$cp = new ClusterParam();
	preg_match($p, trim($_POST[Message]), $m);
	$username = $cp->getMyParamValue("duusername");
	$password = $cp->getMyParamValue("dupassword");
	if (!$username || !$password) {
		return "{myname}。。你还没绑定好【百度】账号。请到私聊窗口 输入 /绑定   来完成操作{ac}";
	}
		$cookes_file = ROOT_PATH . "/Temp/" ."baidu".md5($username.$password) . ".dat";
	 //第一步 获取登录token
	 $tem = ROOT_PATH. "/Temp/tempfile1.txt";
	 $fp = fopen($tem,'wb');
	 $do = new CurlUtil("https://passport.baidu.com/v2/api/?getapi&tpl=mn&apiver=v3&tt=".time()."&class=login&logintype=dialogLogin&callback=");
	 $do->cookie_file = $cookes_file;
	 $do->fp = $fp;
	 $do->https = true;
	 $do->init();
	 $do->getBody();
	 fclose($fp);
	 $a = file_get_contents($tem);
	 $a = str_replace("'","\"",$a);
	 $re = @json_decode($a);
	 @unlink($tem) ;
	 if(!$re ||$re->errInfo->no!="0") {
	 	//unlink($cookes_file) ;
	 	return "获取登录token异常~请重试~{ac}";
	 }
	 $token = $re->data->token;
	 $ph = '/^1[3458][0-9]{9}$/is';
	 $isPhone = 'false';
	 if(preg_match($ph,$username,$x)) {
	 	$isPhone = 'true'; 
	 }
	 $post_fields = "token=".$token."&tpl=mn&apiver=v3&isPhone={$isPhone}&safeflg=0&splogin=rate&mem_pass=on&ppui_logintime=37976".
 	"&username=".URLEncode($username)."&password=".URLEncode($password)."&verifycode=".trim($m[2])."&codestring=".$_SESSION['codestring'];
 	
 	$fp = fopen($tem,'wb');
 	$do = new CurlUtil("https://passport.baidu.com/v2/api/?login");
	$do->cookie_file = $cookes_file;
	$do->https = true;
	$do->post_fields = $post_fields;
	$do->fp=$fp;
	$do->header = 1;
	$do->init();
	$do->getBody();
	fclose($fp);
	$a = file_get_contents($tem);
	$p = '/err_no=([0-9]+).*?codeString=(.*?)&/is';
	preg_match($p, $a, $m);
	if($m[1]!="0") {
		//unlink($cookes_file) ;
		if($m[1]=="257") {
			$_SESSION['codestring']=$m[2];
			$fp = fopen(ROOT_PATH . "/Temp/".$_POST['Sender'].'code.jpg','wb');
			$do = new CurlUtil("https://passport.baidu.com/cgi-bin/genimage?".$m[2]);
			$do->cookie_file = $cookes_file;
			$do->fp = $fp;
			$do->https = true;
			$do->init();
			$do->getBody();
			fclose($fp);
			return "执行命令：@lgbaidu -c 验证码  \n[img]http://127.0.0.1/SoniaRobot/Temp/".$_POST['Sender'].'code.jpg[/img]';
		}
		return "登录异常~错误码{$m[1]},请重试~{ac}";
	} else  {
		return "登录百度成功~{meng}";
	}
}

function signBaidu($cp,$kw) {
	$cp = new ClusterParam();
	$username = $cp->getMyParamValue("duusername");
	$password = $cp->getMyParamValue("dupassword");
	if (!$username || !$password) {
		return "{myname}。。你还没绑定好【百度】账号。请到私聊窗口 输入 /绑定   来完成操作{ac}";
	}
	$cookes_file = ROOT_PATH . "/Temp/" ."baidu".md5($username.$password) . ".dat";
	if (!file_exists($cookes_file)) {
		return "{myname}。。 登录百度账号。请执行命令：@lgbaidu 来完成操作{ac}";
	}
			$do = new CurlUtil("http://tieba.baidu.com/f?kw=".URLEncode(mb_convert_encoding(trim($kw), 'GB2312', 'UTF-8'))."&fr=index");
			$do->cookie_file = $cookes_file;
			$do->init();
			$out = $do->getBody();
			$out = mb_convert_encoding($out, 'UTF-8', 'GB2312');
 			$p = '/PageData\.tbs.*?\"(.*?)\".*?PageData/si';
			preg_match($p, $out, $m);
			if(!$m || !$m[1]) {
				return "贴吧：【{$kw}】不存在或者其他未知原因~~";
			}
			$post_fields = "kw=".URLEncode($kw)."&tbs=".$m[1]."&ie=utf-8";
			$do = new CurlUtil("http://tieba.baidu.com/sign/add");
			$do->cookie_file = $cookes_file;
			$do->post_fields = $post_fields;
			$do->init();
			$out = $do->getBody();
			$re = @json_decode($out);
			if($re) {
				if($re->no=="1101") {
					return $re->error."{ac}";
				}
				else if($re->no=="0") {
					$m = "在贴吧【{$kw}】签到成功:\n";
					$m.="今日签到用户：".$re->data->uinfo->user_sign_rank."\n";
					$m.="连续签到：".$re->data->uinfo->cont_sign_num."\n";
					$m.="共签到：".$re->data->uinfo->cout_total_sing_num."\n";
					return $m;
				} else {
					@unlink($cookes_file) ;
					return $re->error."{ac}";
				}
			} else {
				return "签到操作超时~~";
				
			}
}

function intersect() {
	$p = '/@([\S]+)[\s]+(.*)/si';
	$cp = new ClusterParam();
	preg_match($p, trim($_POST[Message]), $x);
	//print_r($x);
	$cookes_file = ROOT_PATH . "/Temp/qq" .md5("1004634672") . ".dat";
	$tempFile = './temqq.txt' ;
	if(!$x[1]) {
		return "参数异常";
	}
	if(!file_exists($cookes_file)) {
		
	}
	$res =  file_get_contents($cookes_file);
	 $p = '/\bskey\b[\s]*(\S+)\b/is';
	 preg_match($p, $res, $n);
	 $f = ROOT_PATH."Node/gtk.js ".$n[1];
	 $gt_k =  exec("node ".$f);
	 $do = new CurlUtil("http://qun.qzone.qq.com/cgi-bin/get_group_member?uin=1004634672&groupid={$_POST[ClusterNum]}&g_tk={$gt_k}&random=0.".time());
	 $do->cookie_file = $cookes_file;
	 $do->init();
	 $out =   $do->getBody();
	 //echo $out;\);
	 $p = '/_Callback\((.*?)\);/is';
	 preg_match($p, $out, $m);
	 $re = @json_decode($m[1]);
	// print_r($re);
	// return;
	 $c1 = $re->data->item ;
	// echo count($c1)."\n";
	 $do = new CurlUtil("http://qun.qzone.qq.com/cgi-bin/get_group_member?uin=1004634672&groupid={$x[2]}&g_tk={$gt_k}&random=0.".time());
	 $do->cookie_file = $cookes_file;
	 $do->init();
	 $out =   $do->getBody();
	// echo $out;
	 $fp = fopen(ROOT_PATH."/test.txt",'ab');
		 fwrite($fp, $out); 
		 fclose($fp); 
	 preg_match($p, $out, $m);
	//echo substr($out,10,-2);
	 $re = @json_decode(substr($out,10,-2));
	 $c2 = $re->data->item ;
	//print_r($c2);
	 echo count($c2);
	 $name2 =  getClusterNameById(trim($x[2]));
	 $s = "";
	 $cnt = 0;
	 for($i=0;$i<count($c1);$i++) {
	 	$isin = false ;
	 	$tc2 = null;
	 	for($j=0;$j<count($c2);$j++) {
	 		if($c1[$i]->uin==$c2[$j]->uin) {
	 			$isin = true;
	 			$tc2 = $c2[$j];
	 			break;
	 		}
	 	}
	 	if($isin) {
	 		$s.=$c1[$i]->nick."【".$c1[$i]->uin."】";
	 		if($c1[$i]->iscreator==1||$tc2->iscreator==1) {
	 			$s.="(";
	 			if($c1[$i]->iscreator==1) {
	 				$s.="{$_POST[ClusterName]}【群主】";
	 			}
	 			if($tc2->iscreator==1) {
	 				$s.="{$name2}【群主】";
	 			}
	 			$s.=")";
	 		}
	 		
	 		if($c1[$i]->ismanager==1||$tc2->ismanager==1) {
	 			$s.="(";
	 			if($c1[$i]->ismanager==1) {
	 				$s.="{$_POST[ClusterName]}【管理员】";
	 			}
	 			if($tc2->ismanager==1) {
	 				$s.="{$name2}【管理员】";
	 			}
	 			$s.=")";
	 		}
	 		$s.="\n";
	 		$cnt ++;
	 	}
	 }
	 
	 if($cnt>0) {
	 	$s = "在群：[{$_POST[ClusterName]}({$_POST[ClusterNum]})] 和\n群：[{$name2}({$x[2]})]中共同成员为:\n".$s;
	 }
	 return $s;
}

function loginQQ($flag=false) {
//	unset ($_SESSION['LOG_QQ_VIF']);  
//	 unset ($_SESSION['LOGIN_SIG']);
//	 return;
	$p = '/@([\S]+)[\s]+-c([12]*)(.*)/si';
	$cp = new ClusterParam();
	preg_match($p, trim($_POST[Message]), $n);
	//print_r($n);
	//return;
	if($n[2]) {
		if($n[2]==1) {
			$cookesType = "qq";
			$appid= "2001601"  ;
		} else if($n[2]==2) {
			$cookesType = "idqq"; 
			$appid= "1006102";
		} else {
			$cookesType = "qq";
			$appid= "2001601";
		}
	}else {
			$cookesType = "qq";
			$appid= "2001601";
	}
	echo $appid.$cookesType;
	$cookes_file = ROOT_PATH . "/Temp/{$cookesType}" .md5("1004634672") . ".dat";
	$tempFile = './temqq.txt' ;
	$ischeck = false;
	//echo "appid:".$appid;
	if(!isset($_SESSION['LOG_QQ_VIF'])) { 
		 $fp = fopen($tempFile,'wb');
		 $do = new CurlUtil("https://ui.ptlogin2.qq.com/cgi-bin/login?appid={$appid}&no_verifyimg=1&f_url=loginerroralert&lang=0&target=top&hide_title_bar=1&s_url=http%3A//aq.qq.com/cn2/index&qlogin_jumpname=aqjump&qlogin_param=aqdest%3Dhttp%253A//aq.qq.com/cn2/index&css=https%3A//aq.qq.com/v2/css/login.css");
		 $do->cookie_file = $cookes_file;
		 $do->fp = $fp;
		 $do->https = true;
		 $do->init();
		 $do->getBody();
		 fclose($fp);
		 $out =  file_get_contents($tempFile);
		 $p = '/g_login_sig=encodeURIComponent\(\"(.*?)\"\)/is';
		 preg_match($p, $out, $m);
		
		 $login_sig = $m[1];
		 $_SESSION['LOGIN_SIG'] = $login_sig ;
		 $fp = fopen($tempFile,'wb');
		 $do = new CurlUtil("https://ssl.ptlogin2.qq.com/check?pt_tea=1&uin=1004634672&appid={$appid}&js_ver=10114&js_type=0&login_sig={$m[1]}&u1=http%3A%2F%2Faq.qq.com%2Fcn2%2Findex&r=0.".time());
		 
		 $do->cookie_file = $cookes_file;
		 $do->fp = $fp;
		 $do->https = true;
		 $do->init();
		 $do->getBody();
		 fclose($fp);
		 $out =  file_get_contents($tempFile);
		 $p = '/\(\'(.*?)\',\'(.*?)\',\'/is';
		 preg_match($p, $out, $m);
		  //print_r($m);
		 if($m[1]=="1") {
		 	$_SESSION['LOG_QQ_VIF'] = "1";
		 	 $fp = fopen(ROOT_PATH . "/Temp/".$_POST['Sender'].'code.jpeg','wb','wb');
			 $do = new CurlUtil("https://ssl.captcha.qq.com/getimage?&uin=1004634672&aid={$appid}&cap_cd={$m[2]}&r=0.".time());
			 $do->cookie_file = $cookes_file;
			 $do->fp = $fp;
			 $do->https = true;
			 $do->init();
			 $do->getBody();
			 fclose($fp);
		 } else { 
		 	$_SESSION['LOG_QQ_VIF'] = "0";
		 	$verifycode = $m[2];
		 }
	 }
	 
	 if($_SESSION['LOG_QQ_VIF']=="1" && !$n[3]) {
	 	return "执行命令：@lgQQ -c 验证码  \n[img]http://127.0.0.1/SoniaRobot/Temp/".$_POST['Sender'].'code.jpeg[/img]';
	 }
	 
	 if($_SESSION['LOG_QQ_VIF']=="1") { 
	 	$verifycode = $n[3];
	 }
	 //return "11";
 	 $login_sig = $_SESSION['LOGIN_SIG'] ;
 	 $f = ROOT_PATH."Node/a.js ".$verifycode;
 	// echo $f;
	 $value =  exec("node ".$f);
	// echo $value."\n";
	 $fp = fopen($tempFile,'wb');
	 $verifycode = trim($verifycode);
	 $do = new CurlUtil("https://ssl.ptlogin2.qq.com/login?u=1004634672&p={$value}&verifycode={$verifycode}&aid={$appid}&u1=http%3A%2F%2Faq.qq.com%2Fcn2%2Findex&h=1&ptredirect=1&ptlang=2052&from_ui=1&dumy=&fp=loginerroralert&action=4-19-13795&mibao_css=&t=1&g=1&js_type=0&js_ver=10081&login_sig={$login_sig}&r=0.".time());
	 $do->cookie_file = $cookes_file;
	 echo $do->url;
	 $do->fp = $fp;
	 $do->https = true;
	 $do->init();
	 $do->getBody();
	 fclose($fp);
	 $out =  file_get_contents($tempFile);
	 echo $out;
	 unset ($_SESSION['LOG_QQ_VIF']);  
	 unset ($_SESSION['LOGIN_SIG']); 
	 
}

function deleteFri() {
	 $cookes_file = ROOT_PATH . "/Temp/idqq" .md5("1004634672") . ".dat";
	 $post_fields = "ldw=710865361&t=2&u=279126794&vc=pwbv";
	 $do = new CurlUtil("http://id.qq.com/cgi-bin/friends_del");
	 $do->cookie_file = $cookes_file;
	 $do->post_fields = $post_fields;
	 $do->init();
	 $out = $do->getBody();
	 return $out;
}
?>
